package com.byfan.barter.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: FBY
 * @Description 订单类
 * @Version 1.0
 * @Date: 2021/5/14 14:50
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@ApiModel
@Table(name = "orders")
public class Orders implements Serializable {

    /**
     * 订单唯一id
     */
    @ApiModelProperty(value = "订单id（新增时不传参，修改订单时要传参）")
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;


    /**
     * 借出人id
     */
    @ApiModelProperty(value = "借出人openId")
    @Column(name = "from_openid")
    private String fromOpenId;
    /**
     * 借入人id
     */
    @ApiModelProperty(value = "借入人的openId")
    @Column(name = "to_openid")
    private String toOpenId;
    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品的id")
    @Column(name = "commodity_id")
    private int commodityId;

    /**
     * 订单备注
     */
    @ApiModelProperty(value = "订单备注")
    @Column(name = "remarks")
    private String remarks;

    /**
     * 商品状态
     */
    @ApiModelProperty(value = "订单状态")
    @Column(name = "status")
    private String status;

    /**
     * 订单剩余时间
     */
    @ApiModelProperty(value = "订单剩余时间")
    @Column(name = "remaining_time")
    private int remainingTime;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "订单创建时间（任何请求都不用传参）")
    @CreatedDate
    @Column(name = "creat_time")
    private Date creatTime;
    /**
     * 最后修改时间
     */
    @ApiModelProperty(value = "订单修改时间（任何请求都不用传参）")
    @LastModifiedDate
    @Column(name = "update_time")
    private Date updateTime;
}
